//
//  BCButtonEx.swift
//  BCProject
//
//  Created by you&me on 2017/11/28.
//  Copyright © 2017年 杨杨威. All rights reserved.
//

import Foundation
//自定义可绑定的属性
extension UIButton {
    var ex_State:AnyObserver<Bool>{
        return Binder(self) { button, state in
            button.isEnabled = state
            //这样设置不会有误差
            let color = state ? UIColor.orange : UIColor.lightGray
            button.setTitleColor(color, for: .normal)
            }.asObserver()
    }
}
